package ${packageName}.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
* @author ${author}
* @Description ${dbDto.comment} 映射
* @date ${date}
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "${dbDto.tableName}")

@Entity
@Table(name = "${dbDto.tableName}")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "${dbDto.comment} 映射")
public class ${dbDto.className}Po extends BasePo implements Serializable {
<#if dbDto.fieldList ??>
    <#list dbDto.fieldList as field>
    @Schema(description = "${field.remark ! ''}")
    @TableField(value = "${field.columnName}")
    @Column(name = "${field.columnName}", columnDefinition = "<#if field.javaType != 'Date'>${field.columnType}(${field.dataSize}) <#else>${field.columnType} </#if><#if field.nullable = false>NOT NULL </#if>COMMENT '${field.remark}'")
    private <#if field.columnType == 'BIT'>Boolean<#else>${field.javaType}</#if> ${field.fieldName};
    </#list>
</#if>
}
